package com.ftg.learn.mapper;

import com.ftg.learn.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author huye
 * @since 2022-03-11
 */
public interface UserMapper extends BaseMapper<User> {
    @Select("select user_id, user_account, user_name from user where user_account=#{account} and user_password=#{password} and user_status=0")
    User checkUser(@Param("account") String account, @Param("password")String password);

    @Update("update user set user_status=#{num} where user_id = #{id}")
    int updateForUstatus(@Param("id") int id,@Param("num") int num);

    @Update("update user set user_account=#{uaccount},user_name=#{uname} where user_id = #{uid}")
    boolean updateUserInfo(@Param("uid")Long uid, @Param("uaccount")String uaccount, @Param("uname")String uname);

    @Update("update user set user_password=#{upassword} where user_id = #{uid}")
    boolean resetPassword(@Param("uid")Long uid,@Param("upassword") String upassword);
}

